package cn.wolfcode.edu.web.controller;

import cn.wolfcode.edu.domain.LeavingStudent;
import cn.wolfcode.edu.query.QueryObject;
import cn.wolfcode.edu.service.ILeavingStudentService;
import cn.wolfcode.edu.service.ILeavingStudentService;
import cn.wolfcode.edu.util.JsonResult;
import cn.wolfcode.edu.util.PageResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * Created by NEUZJ on 2018/7/9.
 */
@Controller
@RequestMapping("/leavingStudent")
public class LeavingStudentContoller {
    @Autowired 
    private ILeavingStudentService leavingStudentService;
   
    @RequestMapping("")
    public String index() {
        return "leavingstudent";
    }


    @RequestMapping("/list")
    @ResponseBody
    public PageResult list(QueryObject qo) {
        return leavingStudentService.query(qo);
    }
    //保存大客户
    @RequestMapping("/save")
    @ResponseBody
    public JsonResult save(LeavingStudent leavingStudent) {
        JsonResult jsonResult=new JsonResult();
        try {
            leavingStudentService.save(leavingStudent);
        } catch (Exception e) {
            e.printStackTrace();
            jsonResult.remark("出事了");
            return jsonResult;
        }
        return jsonResult;

    }

    //删除退学的学生
    @RequestMapping("/aduit")
    @ResponseBody
    public JsonResult aduit(String tel,Long id) {
        System.out.print(tel);
        System.out.print(id);
        JsonResult jsonResult = new JsonResult();
        try {
            leavingStudentService.aduit(tel,id);
        } catch (Exception e) {
            e.printStackTrace();
            jsonResult.remark("出事了");
            return jsonResult;
        }
        return jsonResult;
    }

}
